<?php
namespace app\index\controller;
use think\Model;
use think\Db;

class User extends Model{
	
      //自定义初始化
    protected function initialize()
    {
        //需要调用`Model`的`initialize`方法
        parent::initialize();
        //TODO:自定义的初始化
    }

  public function index(){
  	//Db::query('select * from user');

  	//echo Db::table('user')-> select();
    
    //$user = new User();
    //$data = $user -> select();
    // 700 * 20 = 14000  22000 - 14000 = 8000  
    // $data = User::get(1);
    // if($data != NULL){
    // 	echo $data -> toJson();
    // }else{
    // 	echo "获取数据NUll";
    // }
   

   // $page = $_REQUEST['page'];
   // if($page == NULL){
   // 	$page = 5;
   // }

   $user = new User();
   $data = $user->limit(20)->select();
    if($data != NULL){
    	
    }else{

    }

	  $jsonData = array('data' => $data); 
      return json_encode($jsonData);
  }

}
?>